/*
 * CComboPoints.java
 * 
 * Copyright (c) 2009 Giles Millward (Manigra). All rights reserved.
 * 
 * This file is part of Expression program is undefined on line 8, column 40 in Templates/Licenses/license-gplv3.txt..
 * 
 * Expression program is undefined on line 10, column 19 in Templates/Licenses/license-gplv3.txt. is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Expression program is undefined on line 15, column 19 in Templates/Licenses/license-gplv3.txt. is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Expression program is undefined on line 21, column 30 in Templates/Licenses/license-gplv3.txt..  If not, see <http://www.gnu.org/licenses/>.
 */

package dpssystem;

/**
 *
 * @author Mani
 */
public class CComboPoints {
    CSim m_sim;
    public int m_comboPoints;
    boolean m_ruthlessnessEnabled = false;
    double m_ruthlessnessChance = 0.0;
    boolean m_sealFateEnabled = false;
    double m_sealFateChance = 0.0;

    CComboPoints(CSim p_sim)
    {
        m_sim = p_sim;
        m_comboPoints = 0;
        if (m_sim.m_dpsInterface.m_talents.getRuthlessness() != 0)
        {
            m_ruthlessnessEnabled = true;
            m_ruthlessnessChance = m_sim.m_dpsInterface.m_talents.getRuthlessnessDouble() * 20.0;
        }

        if (m_sim.m_dpsInterface.m_talents.getSealFate() != 0)
        {
            m_sealFateEnabled = true;
            m_sealFateChance = m_sim.m_dpsInterface.m_talents.getSealFateDouble() * 20.0;
        }

    }

    public void addComboPoints(int p_comboPointsDelta)
    {
        int l_newComboPoints = m_comboPoints + p_comboPointsDelta;
        if (l_newComboPoints > 5)
        {
            m_comboPoints = 5;
        }
        else
        {
            m_comboPoints = l_newComboPoints;
        }
    }

    // Call this after completing a MELEE finisher
    public void ruthlessness()
    {
        if (m_ruthlessnessEnabled)
        {
            if (m_sim.m_rng.nextDouble() <= m_ruthlessnessChance)
            {
                addComboPoints(1);
            }
        }
    }

    // Called when crits add a combo point
    public void sealFate()
    {
        if (m_sealFateEnabled)
        {
            if (m_sim.m_rng.nextDouble() <= m_sealFateChance)
            {
                addComboPoints(1);
            }
        }
    }
}
